//
//  ViewController.m
//  10502
//
//  Created by student on 16/2/19.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)BtnPressed:(id)sender
{
  //  - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange;
    
    NSString *modeltext = self.modelTextView.text;
    NSString *outtext = [modeltext stringByReplacingOccurrencesOfString:@"<name>" withString:self.nameTextField.text];
    NSString *outtext2 = [outtext stringByReplacingOccurrencesOfString:@"<age>" withString:self.ageTextField.text];
    NSString *outtext3 = [outtext2 stringByReplacingOccurrencesOfString:@"<class>" withString:self.classTextField.text];
    self.OutTextView.text = outtext3;
}

- (IBAction)backTap:(id)sender
{
    // 两种方法
    // 1. 结束编辑
    [self.view endEditing:YES];
    
    //    // 2. 取消第一响应者
    //    [self.nameTextField resignFirstResponder];
    //    [self.phoneTextField resignFirstResponder];
    //    
}

@end
